package com.yeyuan.service.impl;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yeyuan.dao.IUserDao;
import com.yeyuan.entity.User;
import com.yeyuan.service.IUserService;
@Service
public class UserServiceImpl implements IUserService {
	
	@Resource
	IUserDao userDaoImpl;
	
	@Override
	public User getUserByUserName(String userName) {
		if(userDaoImpl.getUserByUserName(userName)!=null){
			User user=userDaoImpl.getUserByUserName(userName);
			return user;
		}else{
			return null;
		}
	}

	@Override
	public User loginUser(User user) {
		if(userDaoImpl.getResultByUser(user)!=null){
			user=userDaoImpl.getResultByUser(user);
			return user;
		}else{
			return null;
		}
	}

	@Override
	public User registerUser(User user) {
		user=userDaoImpl.registerUser(user);
		return user;
			
	}

	@Override
	public User getUserByUserID(String userID) {
		if(userDaoImpl.getUserByUserID(userID)!=null){
			User user=userDaoImpl.getUserByUserID(userID);
			return user;
		}else{
			return null;
		}
	}

}
